<?php
include(APPPATH.'libraries/taoapi/RequestCheckUtil.php');
include(APPPATH.'libraries/taoapi/TopClient.php');
class TaoApi 
{
	protected $c = NULL;

	function __construct()
	{
		$this->c = new TopClient();
		$this->c->appkey = '12056677';
		$this->c->secretKey = 'aa68718a6d55287e70dd3db3a4641340';
		$this->c->format = 'json';
	}
	public function getItemCate($cid = 0) 
	{
		require_once(APPPATH.'libraries/taoapi/request/ItemcatsGetRequest.php');
		$req = new ItemcatsGetRequest;
		$req->setFields("cid,parent_cid,name,is_parent");
		$req->setParentCid($cid);

		return $this->c->execute($req);
	}
	public function getProp($cid) 
	{
		if(empty($cid)) return array();
		
		require_once(APPPATH.'libraries/taoapi/request/ItempropsGetRequest');
		$req = new ItempropsGetRequest;
		$req->setFields("pid,name,must,multi,prop_values");
		$req->setCid($cid);

		return $this->c->execute($req);
	}
}
?>